//
//  WarnModel.m
//  YuTang
//
//  Created by 葛悦彣 on 2024/8/30.
//

#import "WarnModel.h"

@implementation WarnModel

+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"ID":@[@"id"],
    };
}

+ (NSDictionary *)modelContainerPropertyGenericClass {
    return @{
        @"alarmProcessRecord":[alarmProcessRecordModel class],
        @"alarmData":[alarmDataModel class],
        @"alarmDataList":[alarmDataModel class],
        @"pondTissues":[CombinedPunchTissueListModel class],
    };
}

- (NSString *)tissueListStr{
    if(!_tissueListStr){
        NSMutableArray <NSString *>* strArray = [NSMutableArray array];
        for (CombinedPunchTissueListModel * model in self.pondTissues) {
            NSString * str = [NSString stringWithFormat:@"%@ %@",model.pondTissue,model.pondName];
            [strArray addObject:str];
        }
        _tissueListStr = [strArray componentsJoinedByString:@"\n"];
    }
    return _tissueListStr;
}

- (CGFloat)tissueListStrH{
    CGFloat textH = [DTKTool textWithtitle:self.tissueListStr andSize:CGSizeMake(kwt(350), 10000) andFout:kCFont(15)].height;
    if(textH < kwt(15)){
        return kwt(15);
    }
    return textH;
}
- (CGFloat)CellH{
    return kwt(44 + 76 + 15);
}
-(CGFloat)DetailsCellH{
    return kwt(44 + 76) + self.tissueListStrH;

}

//-(NSString *)pondStr{
//    if(!_pondStr){
//        _pondStr = [NSString stringWithFormat:@"%@ %@",self.pondTissueName,self.pondName];
//    }
//    return _pondStr;
//}
//
//- (CGFloat)pondStrH{
//    if(_pondStrH == 0){
//        _pondStrH = [DTKTool textWithtitle:self.pondStr andSize:CGSizeMake(kwt(351), 1000) andFout:kFont(15)].height;
//    }
//    return _pondStrH;
//}
-(CGFloat)pondViewH{
    if(self.tissueListStr.length > 0){
        return self.tissueListStrH + kwt(10);
    }
    return 0;
}

-(CGFloat)GJviewH{
    if(self.alarmData){
        if(_GJviewH == 0){
            if(self.alarmDataType == 3){
                _GJviewH = 0;
                if(self.alarmData.remark.length > 0){
                    _GJviewH = kwt(48 + 36);
                }
                if(self.alarmData.data.length > 0){
                    _GJviewH = kwt(48) + self.alarmData.dataH;
                    if(self.alarmData.remark.length > 0){
                        _GJviewH = kwt(36 + 48) + self.alarmData.dataH;
                    }
                }
                
                if(_GJviewH == 0){
                    _GJviewH = kwt(48 + 36);
                }
            } else if(self.alarmDataType == 2){
                _GJviewH = kwt(48 + 12 + 12 + 12) + self.alarmData.taskNameStrH + self.alarmData.executeTimeStrH + self.alarmData.executorStrH;
            } else if(self.alarmDataType == 1){
                _GJviewH = kwt(48);
                for (alarmDataModel * model in self.alarmDataList) {
                    if(model.children.count > 0){
                        _GJviewH += kwt(43);
                        for (alarmDataModel * childrenModel in model.children) {
                            _GJviewH += childrenModel.msStrH + kwt(14);
                        }
                    } else {
                        _GJviewH += model.msStrH + kwt(14);
                    }
                }
                
            }
        }
    }
    if(self.alarmDataList.count > 0){
        if(self.alarmDataType == 1){
            _GJviewH = kwt(48);
            for (alarmDataModel * model in self.alarmDataList) {
                if(model.children.count > 0){
                    _GJviewH += kwt(43);
                    for (alarmDataModel * childrenModel in model.children) {
                        _GJviewH += childrenModel.msStrH + kwt(14);
                    }
                } else {
                    _GJviewH += model.msStrH + kwt(14);
                }
            }
            
        }
    }
    return _GJviewH;
}
- (CGFloat)CLviewH{
    if(self.alarmProcessRecord.count < 1){
        return 0;
    }
    //    if(_CLviewH == 0){
    _CLviewH = kwt(45 + 10);
    for (alarmProcessRecordModel * model in self.alarmProcessRecord) {
        _CLviewH += model.backviewH + kwt(8) + model.userH;
    }
    //    }
    return _CLviewH;
}

- (CGFloat)FooterviewH{
    if(self.GJviewH > 0){
        return self.GJviewH + kwt(10) + self.CLviewH;
    }
    return self.CLviewH;
    
}

@end
@implementation alarmProcessRecordModel

+ (NSDictionary *)modelContainerPropertyGenericClass {
    return @{
        @"detail":[alarmProcessDetailModel class],
        @"detailList":[alarmProcessDetailModel class],
    };
}

+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"detailList":@[@"detailList",@"addTaskDetail"],
    };
}

-(CGFloat)createTimeW{
    if(_createTimeW == 0){
        _createTimeW = [DTKTool textWithtitle:self.createTime andSize:CGSizeMake(10000, 10000) andFout:kFont(15)].width;
    }
    return _createTimeW;
}
-(CGFloat)userH{
    if(_userH == 0){
        _userH = [DTKTool textWithtitle:self.user andSize:CGSizeMake(kwt(300) - self.createTimeW, 10000) andFout:kCFont(17)].height;
        if(_userH < kwt(17)){
            _userH = kwt(17);
        }
    }
    return _userH;
}
-(CGFloat)backviewH{
    if(self.type == 2){
        _backviewH = kwt(50 - 8);///循环的时候会加上
        if(self.detail.CopytaskDetailModelList.count > 1){
            ///加1个标题
            for (taskDetailModelListModel * model in self.detail.CopytaskDetailModelList) {
                if(model.isSQ){
                    _backviewH += kwt(48);
                } else {
                    _backviewH += model.strH + kwt(8) + kwt(40) + self.userH;
                }
            }
        } else if(self.detail.CopytaskDetailModelList.count == 1){
            _backviewH += self.detail.CopytaskDetailModelList.firstObject.strH + kwt(8) + self.userH;
        } else {
            _backviewH = kwt(20) + self.dkrwStrH;
        }
        
        if(self.detail.cardImgArray.count > 0){
            _backviewH += kwt(80);
            if(self.detail.cardImgArray.count > 5){
                _backviewH += kwt(60);
            }
        }
        if(self.detail.voiceUrl.length > 0){
            _backviewH += kwt(50);
        }
    }
    if(_backviewH == 0){
        ///类型 1:新增任务 2:打卡记录 3:关闭 4:审批进程
        if(self.type == 1){
            for (alarmProcessDetailModel * detail in self.detailList) {
                _backviewH += detail.xzrwStrH + kwt(20);
            }
            //        } else if(self.type == 2){
            //            _backviewH = kwt(20 - 8);///循环的时候会加上
            //            if(self.detail.taskDetailModelList.count > 1){
            //                for (taskDetailModelListModel * model in self.detail.taskDetailModelList) {
            //
            //                    if(model.isSQ){
            //                        _backviewH += kwt(48);
            //
            //                    } else {
            //                        _backviewH += model.strH + kwt(8 + 20) + kwt(40);
            //                    }
            //                }
            //            } else {
            //                _backviewH += self.detail.taskDetailModelList.firstObject.strH + kwt(8 + 20);
            //            }
            //
            //            if(self.detail.cardImgArray.count > 0){
            //                _backviewH += kwt(80);
            //                if(self.detail.cardImgArray.count > 5){
            //                    _backviewH += kwt(60);
            //                }
            //            }
            //            if(self.detail.voiceUrl.length > 0){
            //                _backviewH += kwt(50);
            //            }
        } else if(self.type == 3){
            _backviewH = self.shrwStrH + kwt(20);
        } else if(self.type == 4){
            _backviewH = self.shrwStrH + kwt(20);
            
        }
    }
    
    return _backviewH;
}


-(NSAttributedString *)shrwStr{
    if(!_shrwStr){
        
        NSString * onelab = @"";
        NSString * twelab = @"";
        if(self.type == 3){//关闭
            onelab = @"关闭告警";
            twelab = [NSString stringWithFormat:@"关闭原因：%@",self.detail.closeReason];
        } else if(self.type == 4){//审核
            /// 进程类型 1 取消 2 转交 3 同意 4 拒绝，其主要用于区分通用型字段
            //            if(self.detail.processType == 1){
            //                onelab = @"申请取消任务";
            //                twelab = [NSString stringWithFormat:@"取消原因：%@",self.detail.reason];
            //
            //            }else if(self.detail.processType == 2){
            //                onelab = @"申请转交任务";
            //                twelab = [NSString stringWithFormat:@"转交原因：%@",self.detail.reason];
            //
            //            }else if(self.detail.processType == 3){
            //                onelab = @"审批同意";
            //            }else if(self.detail.processType == 4){
            //                onelab = @"审核拒绝";
            //                twelab = [NSString stringWithFormat:@"拒绝原因：%@",self.detail.reason];
            //            }
            onelab = self.detail.title;
            twelab = self.detail.content;
        }
        NSString * str = [NSString stringWithFormat:@"%@\n%@",onelab,twelab];
        if(twelab.length < 1){
            str = onelab;
        }
        _shrwStr = [DTKTool AttributedStringWithStr:str andNodeColor:KcolorHex(@"#222222") andSeledColor:KcolorHex(@"#2C72F7") andNodeFont:kCFont(16) andFont:kFont(15) andPattenr:onelab];
    }
    return _shrwStr;
}
- (CGFloat)shrwStrH{
    if(_shrwStrH == 0){
        _shrwStrH = [DTKTool textWithAttStr:self.shrwStr andSize:CGSizeMake(kwt(298), 10000)].height;
        
    }
    return _shrwStrH;
}
- (NSAttributedString *)dkrwStr{
    if(!_dkrwStr){
        _dkrwStr = [DTKTool AttributedStringWithStr:[NSString stringWithFormat:@"打卡【%@】",self.detail.taskName] andNodeColor:KcolorHex(@"#222222") andSeledColor:KcolorHex(@"#0967FF") andNodeFont:kCFont(16) andFont:kFont(16) andPattenr:[NSString stringWithFormat:@"【%@】",self.detail.taskName]];
    }
    return _dkrwStr;
}
- (CGFloat)dkrwStrH{
    if(_dkrwStrH == 0){
        _dkrwStrH = [DTKTool textWithAttStr:self.dkrwStr andSize:CGSizeMake(kwt(298), 10000)].height;
        
    }
    return _dkrwStrH;
}


@end

@implementation alarmProcessDetailModel
-(NSMutableArray<taskDetailModelListModel *> *)CopytaskDetailModelList{
    if(!_CopytaskDetailModelList){
        _CopytaskDetailModelList = [NSMutableArray array];
        for (taskDetailModelListModel * model in self.taskDetailModelList) {
            if(model.str.length > 0){
                [_CopytaskDetailModelList addObject:model];
            }
        }
    }
    return _CopytaskDetailModelList;
}
+ (NSDictionary *)modelCustomPropertyMapper {
    return @{
        @"voiceUrl":@[@"voiceUrl",@"voiceRemark"],
        @"taskDetailModelList":@[@"pondModelList",@"taskDetailModelList"]
    };
}

+ (NSDictionary *)modelContainerPropertyGenericClass {
    return @{
        @"taskDetailModelList":[taskDetailModelListModel class],
    };
}

- (NSAttributedString *)xzrwStr{
    if(!_xzrwStr){
        _xzrwStr = [DTKTool AttributedStringWithStr:[NSString stringWithFormat:@"新增【%@】，执行人：%@，执行时间：%@",self.taskName,self.executor,self.executeTime] andNodeColor:KcolorHex(@"#222222") andSeledColor:KcolorHex(@"#0967FF") andNodeFont:kCFont(16) andFont:kFont(15) andPattenr:[NSString stringWithFormat:@"【%@】",self.taskName]];
    }
    return _xzrwStr;
}
-(CGFloat)xzrwStrH{
    if(_xzrwStrH == 0){
        _xzrwStrH = [DTKTool textWithAttStr:self.xzrwStr andSize:CGSizeMake(kwt(298), 10000)].height;
        
    }
    return _xzrwStrH;
}
- (void)setVoiceUrl:(NSString *)voiceUrl{
    _voiceUrl = voiceUrl;
    NSError * error ;
    AVURLAsset* audioAsset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:voiceUrl] options: @{AVURLAssetPreferPreciseDurationAndTimingKey:@(YES)}];
    [audioAsset loadValuesAsynchronouslyForKeys:@[@"duration"] completionHandler:^{
        dispatch_async(dispatch_get_main_queue(), ^{
            AVKeyValueStatus status = [audioAsset statusOfValueForKey:@"duration" error:nil];
            if(status == AVKeyValueStatusLoaded){
                CMTime audioDuration = audioAsset.duration;
                float audioDurationSeconds = CMTimeGetSeconds(audioDuration);
                self.voiceDuration = [NSString stringWithFormat:@"%.0f\"",round(audioDurationSeconds)];
                if(self.openDurationBlock){
                    self.openDurationBlock(self.voiceDuration);
                }
            }
        });
    }];
    
}
-(NSArray<NSString *> *)cardImgArray{
    if(!_cardImgArray){
        if(self.cardImg.length > 0){
            _cardImgArray = [self.cardImg componentsSeparatedByString:@","];
        } else {
            _cardImgArray = [NSArray array];
        }
    }
    return _cardImgArray;
}

-(CGFloat)executorStrH{
    if(_executorStrH == 0){
        _executorStrH = [DTKTool textWithtitle:[NSString stringWithFormat:@"执行人：%@",self.executor] andSize:CGSizeMake(kwt(250), 10000) andFout:kCFont(15)].height;
    }
    return _executorStrH;
}
@end

@implementation alarmDataModel

+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"ID":@[@"id"],
    };
}

+ (NSDictionary *)modelContainerPropertyGenericClass {
    return @{
        @"children":[alarmDataModel class],
    };
}

- (CGFloat)dataH{
    if(_dataH == 0){
        _dataH = [DTKTool textWithtitle:self.data andSize:CGSizeMake(kwt(335), 1000) andFout:kFont(16)].height + kwt(14);
    }
    return _dataH;
}

- (NSAttributedString *)msStr{
    if(!_msStr){
        NSString * unitName = @"";
        if(self.unitName.length > 0){
            unitName = self.unitName;
        }
        _msStr = [DTKTool AttributedStringWithStr:[NSString stringWithFormat:@"%@：%@%@(正常值：%@%@)",self.name,self.number,unitName,self.normalValue,unitName] andNodeColor:KcolorHex(@"#222222") andSeledColor:KcolorHex(@"#656565") andNodeFont:kFont(17) andFont:kFont(17) andPattenr:[NSString stringWithFormat:@"%@：",self.name]];
    }
    return _msStr;
}
- (CGFloat)msStrH{
    if(_msStrH == 0){
        _msStrH = [DTKTool textWithAttStr:self.msStr andSize:CGSizeMake(kwt(335), 10000)].height;
    }
    return _msStrH;
}
-(CGFloat)msStrViewH{
    if(_msStrViewH == 0){
        if(self.children.count > 0){///有子集
            _msStrViewH = kwt(43);
            for (alarmDataModel * model in self.children) {
                _msStrViewH += model.msStrH + kwt(14);
            }
        } else {
            _msStrViewH = self.msStrH + kwt(14);
        }
    }
    return _msStrViewH;
}
-(CGFloat)taskNameStrH{
    if(_taskNameStrH == 0){
        _taskNameStrH = [DTKTool textWithtitle:self.taskName andSize:CGSizeMake(kwt(255), 10000) andFout:kFont(17)].height;
    }
    return _taskNameStrH;
}

-(CGFloat)executorStrH{
    if(_executorStrH == 0){
        _executorStrH = [DTKTool textWithtitle:self.executor andSize:CGSizeMake(kwt(255), 10000) andFout:kFont(17)].height;
    }
    return _executorStrH;
}
-(CGFloat)executeTimeStrH{
    if(_executeTimeStrH == 0){
        _executeTimeStrH = [DTKTool textWithtitle:self.executeTime andSize:CGSizeMake(kwt(255), 10000) andFout:kFont(17)].height;
    }
    return _executeTimeStrH;
}
- (void)setRemark:(NSString *)remark{
    _remark = remark;
    //    NSError * error ;
    AVURLAsset* audioAsset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:remark] options: @{AVURLAssetPreferPreciseDurationAndTimingKey:@(YES)}];
    [audioAsset loadValuesAsynchronouslyForKeys:@[@"duration"] completionHandler:^{
        dispatch_async(dispatch_get_main_queue(), ^{
            AVKeyValueStatus status = [audioAsset statusOfValueForKey:@"duration" error:nil];
            if(status == AVKeyValueStatusLoaded){
                CMTime audioDuration = audioAsset.duration;
                float audioDurationSeconds = CMTimeGetSeconds(audioDuration);
                self.voiceDuration = [NSString stringWithFormat:@"%.0f\"",round(audioDurationSeconds)];
                if(self.openDurationBlock){
                    self.openDurationBlock(self.voiceDuration);
                }
            }
        });
    }];
    
}

@end

@implementation taskDetailModelListModel


- (NSAttributedString *)str{
    if(!_str){
        NSString * nrstr = @"";
        NSString * Pattenrstr = @"";
        ///先判断是不是最外层
        
        for (TemplateFoundDetailsTaskItemModelListModel * taskModel in self.taskItemModelList) {
            if(taskModel.itemModelList.count > 0){///有子集
                if(taskModel.pattern == 1){
//                    if(taskModel.SubsetNoitemModelList.count > 0){//10.31下午程慧说所有子任务项都显示
                        NSMutableArray * nameArray = [NSMutableArray array];
                        for (TemplateFoundDetailsItemModelListModel * itemModel in taskModel.itemModelList) {
                            [nameArray addObject:itemModel.name];
                        }
                        if(nrstr.length > 0){
                            nrstr = [NSString stringWithFormat:@"%@\n%@：%@",nrstr,taskModel.name,[nameArray componentsJoinedByString:@","]];
                        } else {
                            nrstr = [NSString stringWithFormat:@"%@：%@",taskModel.name,[nameArray componentsJoinedByString:@","]];
                        }
//                    }
                    for (TemplateFoundDetailsItemModelListModel * itemModel in taskModel.itemModelList) {
                        if(itemModel.itemList.count == 1){///有单选
                            if(nrstr.length > 0){
                                nrstr = [NSString stringWithFormat:@"%@\n%@：%@",nrstr,itemModel.itemList.firstObject.name,itemModel.itemList.firstObject.contentStr];
                            } else {
                                nrstr = [NSString stringWithFormat:@"%@：%@",itemModel.itemList.firstObject.name,itemModel.itemList.firstObject.contentStr];
                            }
                        } else if(itemModel.itemList.count > 1){///有多选
                            //                      ///先加标题
                            if(nrstr.length > 0){
                                nrstr = [NSString stringWithFormat:@"%@\n%@:",nrstr,itemModel.name];
                            } else{
                                nrstr = [NSString stringWithFormat:@"%@:",itemModel.name];
                            }
                            if(Pattenrstr.length > 0){
                                Pattenrstr = [NSString stringWithFormat:@"%@|(%@)",Pattenrstr,[NSString stringWithFormat:@"%@:",itemModel.name]];
                            } else {
                                Pattenrstr = [NSString stringWithFormat:@"(%@:)",itemModel.name];
                            }
                            for (TemplateFoundDetailsItemListModel * itemListModel in itemModel.itemList) {
                                if(nrstr.length > 0){
                                    nrstr = [NSString stringWithFormat:@"%@\n%@：%@",nrstr,itemListModel.name,itemListModel.contentStr];
                                } else {
                                    nrstr = [NSString stringWithFormat:@"%@：%@",itemListModel.name,itemListModel.contentStr];
                                }
                            }
                        } else {///没有选项的 不显示
//                            if(nrstr.length > 0){
//                                nrstr = [NSString stringWithFormat:@"%@\n%@",nrstr,itemModel.name];
//                            } else{
//                                nrstr = [NSString stringWithFormat:@"%@",itemModel.name];
//                            }
                        }
                    }
                } else if(taskModel.pattern == 2){
                    if(nrstr.length > 0){
                        nrstr = [NSString stringWithFormat:@"%@\n%@：%@",nrstr,taskModel.name,taskModel.itemModelList.firstObject.name];
                    } else{
                        nrstr = [NSString stringWithFormat:@"%@：%@",taskModel.name,taskModel.itemModelList.firstObject.name];
                    }
                    for (TemplateFoundDetailsItemModelListModel * itemModel in taskModel.itemModelList) {
                        if(itemModel.itemList.count == 1){///有单选
                            if(nrstr.length > 0){
                                nrstr = [NSString stringWithFormat:@"%@\n%@：%@",nrstr,itemModel.itemList.firstObject.name,itemModel.itemList.firstObject.contentStr];
                            } else {
                                nrstr = [NSString stringWithFormat:@"%@：%@",itemModel.itemList.firstObject.name,itemModel.itemList.firstObject.contentStr];
                            }
                        } else if(itemModel.itemList.count > 1){///有多选
                            //                      ///先加标题
                            if(nrstr.length > 0){
                                nrstr = [NSString stringWithFormat:@"%@\n%@:",nrstr,itemModel.name];
                            } else{
                                nrstr = [NSString stringWithFormat:@"%@:",itemModel.name];
                            }
                            if(Pattenrstr.length > 0){
                                Pattenrstr = [NSString stringWithFormat:@"%@|(%@)",Pattenrstr,[NSString stringWithFormat:@"%@:",itemModel.name]];
                            } else {
                                Pattenrstr = [NSString stringWithFormat:@"(%@:)",itemModel.name];
                            }
                            for (TemplateFoundDetailsItemListModel * itemListModel in itemModel.itemList) {
                                if(nrstr.length > 0){
                                    nrstr = [NSString stringWithFormat:@"%@\n%@：%@",nrstr,itemListModel.name,itemListModel.contentStr];
                                } else {
                                    nrstr = [NSString stringWithFormat:@"%@：%@",itemListModel.name,itemListModel.contentStr];
                                }
                            }
                        } else {///没有选项的 不显示
//                            if(nrstr.length > 0){
//                                nrstr = [NSString stringWithFormat:@"%@\n%@",nrstr,itemModel.name];
//                            } else{
//                                nrstr = [NSString stringWithFormat:@"%@",itemModel.name];
//                            }
                        }
                    }
                    
                } else {
                    if(nrstr.length > 0){
                        nrstr = [NSString stringWithFormat:@"%@\n%@：%@",nrstr,taskModel.name,taskModel.numberStr];
                    } else {
                        nrstr = [NSString stringWithFormat:@"%@：%@",taskModel.name,taskModel.numberStr];
                    }
                }
            } else {
                if(nrstr.length > 0){
                    nrstr = [NSString stringWithFormat:@"%@\n%@：%@",nrstr,taskModel.name,taskModel.numberStr];
                } else {
                    nrstr = [NSString stringWithFormat:@"%@：%@",taskModel.name,taskModel.numberStr];
                }
            }
        }
        
        
        NSRegularExpression *regular = [NSRegularExpression regularExpressionWithPattern:Pattenrstr options:0 error:NULL];
        
        NSArray<NSTextCheckingResult *> *ranges = [regular matchesInString:nrstr options:0 range:NSMakeRange(0, [nrstr length])];
        
        nrstr = [nrstr stringByReplacingOccurrencesOfString:@"(null)" withString:@"-"];

        NSMutableAttributedString * str = [DTKTool AttributedStringWithStr:nrstr andNodeColor:KcolorHex(@"#787A79") andSeledColor:KcolorHex(@"#222222") andNodeFont:kFont(14) andFont:kFont(14) andPattenr:@""];
        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
        paragraphStyle.alignment = NSTextAlignmentNatural; //设置两端对齐显示
        paragraphStyle.hyphenationFactor = 0;
        paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
        paragraphStyle.lineSpacing = kwt(5); // 设置行间距
        //        [str setAttributes:@{NSForegroundColorAttributeName : KcolorHex(@"#222222"),NSFontAttributeName:kFont(14),NSParagraphStyleAttributeName :paragraphStyle} range:NSMakeRange(0, Pattenrstr.length)];
        for (int i = 0; i < ranges.count; i++) {
            //KcolorHex(@"#222222")
            [str setAttributes:@{NSForegroundColorAttributeName : KcolorHex(@"#222222"),NSFontAttributeName:kFont(14),NSParagraphStyleAttributeName :paragraphStyle,} range:ranges[i].range];
        }
        _str = str;
        
    }
    return _str;
}
-(CGFloat)strH{
    if(_strH == 0){
        _strH = [DTKTool textWithAttStr:self.str andSize:CGSizeMake(kwt(272), 10000)].height;
    }
    return _strH;
}
- (CGFloat)RZstrH{
    if(_strH == 0){
        _strH = [DTKTool textWithAttStr:self.str andSize:CGSizeMake(kwt(252), 10000)].height;
    }
    return _strH;
}
-(NSString *)numberStr{
    return @"";
    //        if(self.children.count > 1){
    //            NSString * str = @"";
    //            for (taskDetailModelListModel * model in self.children) {
    //                if(str.length > 0){
    //                    str = [NSString stringWithFormat:@"%@,%@",str,model.taskName?model.taskName:@"--"];
    //                } else {
    //                    str = model.taskName;
    //                }
    //            }
    //            return str;
    //        } else if(self.children.count == 1){
    //            if(self.children.firstObject.number.length > 0){
    //                return [NSString stringWithFormat:@"%@%@",self.number,self.unitName?self.unitName:@""];
    //            }
    //            return self.children.firstObject.taskName;
    //        } else {
    //            return [NSString stringWithFormat:@"%@%@",self.number,self.unitName?self.unitName:@""];
    //        }
}

@end
